/*      */ package com.engine;
/*      */ 
/*      */ import com.engines.DBEngine;
/*      */ import com.ui.LCDProps;
/*      */ import com.ui.SQUI;
/*      */ import java.io.IOException;
/*      */ import java.io.InputStream;
/*      */ import java.io.OutputStream;
/*      */ import java.io.PrintStream;
/*      */ import java.text.DecimalFormat;
/*      */ import java.text.SimpleDateFormat;
/*      */ import java.util.Calendar;
/*      */ import java.util.Collection;
/*      */ import java.util.Date;
/*      */ import java.util.Enumeration;
/*      */ import java.util.HashMap;
/*      */ import java.util.Iterator;
/*      */ import java.util.LinkedList;
/*      */ import java.util.Queue;
/*      */ import java.util.TooManyListenersException;
/*      */ import javax.comm.CommPortIdentifier;
/*      */ import javax.comm.PortInUseException;
/*      */ import javax.comm.SerialPort;
/*      */ import javax.comm.SerialPortEvent;
/*      */ import javax.comm.SerialPortEventListener;
/*      */ import javax.comm.UnsupportedCommOperationException;
/*      */ import org.apache.log4j.Category;
/*      */ 
/*      */ public class SQEngine
/*      */   implements Runnable, SerialPortEventListener, IServiceKode, IXML
/*      */ {
/*      */   static CommPortIdentifier portId;
/*      */   static Enumeration portList;
/*   35 */   static int MAX_SERVICE = 16;
/*      */   InputStream inputStream;
/*      */   SerialPort serialPort;
/*      */   Thread readThread;
/*      */   static OutputStream outStream;
/*   40 */   static final Category log = Category.getInstance(SQEngine.class);
/*   41 */   private boolean isPortOpen = false;
/*      */   private DisplayTools dt;
/*      */   private byte charResponse;
/*      */   private DecimalFormat dec;
/*   45 */   final DecimalFormat dec1 = new DecimalFormat("00");
/*      */   private HashMap<Integer, CounterDisplay> mapVIP;
/*      */   private HashMap<String, Integer> mapVIPKeep;
/*      */   private DBEngine db;
/*      */   private HashMap<Integer, Boolean> mapCurrentUp;
/*   50 */   DecimalFormat tiketFormat = new DecimalFormat("0000");
/*   51 */   private XMLEngine xml = null;
/*   52 */   private HashMap<String, TimeManagement> tm = new HashMap();
/*   53 */   private HashMap<Integer, QueueService> mapQueueService = null;
/*      */ 
/*   55 */   Queue<String> queue = new LinkedList();
/*   56 */   Queue<Integer> queueNo = new LinkedList();
/*      */ 
/*   58 */   int[] counter_up = new int[16];
/*   59 */   int[] counter_down = new int[16];
/*      */ 
/*   61 */   private HashMap<Integer, String> sendKeypad = new HashMap();
/*      */ 
/*      */   public SQEngine(DisplayTools dt)
/*      */   {
/*   65 */     this.dt = dt;
/*   66 */     this.mapQueueService = new HashMap();
/*   67 */     this.db = new DBEngine();
/*      */   }
/*      */ 
/*      */   public SQEngine()
/*      */   {
/*   72 */     this.mapQueueService = new HashMap();
/*   73 */     boolean portavail = false;
/*   74 */     log.info("SQEngine initialize");
/*   75 */     if (this.dt == null) {
/*   76 */       this.dt = new DisplayTools();
/*      */     }
/*   78 */     this.db = new DBEngine();
/*      */ 
/*   80 */     this.dec = new DecimalFormat(this.dt.getFormatCounter());
/*      */ 
/*   82 */     this.mapVIP = new HashMap();
/*   83 */     this.mapVIPKeep = new HashMap();
/*   84 */     this.mapCurrentUp = new HashMap();
/*   85 */     portList = CommPortIdentifier.getPortIdentifiers();
/*   86 */     while (portList.hasMoreElements()) {
/*   87 */       portId = (CommPortIdentifier)portList.nextElement();
/*   88 */       if ((portId.getPortType() != 1) || 
/*   89 */         (!portId.getName().equals(COMMPORT.commport))) continue;
/*   90 */       log.info("COM: " + portId.getName());
/*   91 */       SQUI.App.writeLog("COM: " + portId.getName() + " is open");
/*   92 */       if (!portavail)
/*   93 */         portavail = true;
/*   94 */       this.isPortOpen = true;
/*      */ 
/*   96 */       init();
/*      */     }
/*      */ 
/*   99 */     if (!portavail)
/*  100 */       log.info("!Port is not availabe. Please check your commport");
/*      */   }
/*      */ 
/*      */   public void reset(int idx, int reset)
/*      */   {
/*  105 */     this.counter_up[idx] = reset;
/*  106 */     this.counter_down[idx] = reset;
/*      */   }
/*      */ 
/*      */   public void stop()
/*      */   {
/*      */     try
/*      */     {
/*  113 */       this.isPortOpen = false;
/*  114 */       if (this.db != null)
/*  115 */         this.db.close();
/*  116 */       this.db = null;
/*      */ 
/*  118 */       if (outStream != null)
/*  119 */         outStream.close();
/*  120 */       outStream = null;
/*      */     }
/*      */     catch (Exception localException)
/*      */     {
/*      */     }
/*      */   }
/*      */ 
/*      */   public void start()
/*      */   {
/*  129 */     this.isPortOpen = true;
/*  130 */     init();
/*      */   }
/*      */ 
/*      */   private void init() {
/*      */     try {
/*  135 */       log.info("init SQApp...");
/*      */ 
/*  137 */       if (this.xml == null)
/*      */       {
/*  139 */         SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
/*  140 */         this.xml = new XMLEngine("datas/" + sdf.format(new Date()) + ".xml", this.dt.getCounter_keypad());
/*  141 */         this.xml.setXML(this);
/*      */       }
/*      */ 
/*  144 */       if (this.serialPort == null)
/*  145 */         this.serialPort = ((SerialPort)portId.open("SQApp", 2000));
/*      */     }
/*      */     catch (PortInUseException e) {
/*  148 */       log.info(e.getLocalizedMessage());
/*      */     }
/*      */     try {
/*  151 */       if (this.serialPort != null)
/*  152 */         this.inputStream = this.serialPort.getInputStream();
/*      */     } catch (IOException e) {
/*  154 */       log.info(e.getLocalizedMessage());
/*      */     }
/*      */     try {
/*  157 */       if (this.serialPort != null)
/*  158 */         this.serialPort.addEventListener(this);
/*      */     }
/*      */     catch (TooManyListenersException e) {
/*  161 */       log.info(e.getLocalizedMessage());
/*      */     }
/*      */ 
/*  164 */     if (this.serialPort != null)
/*  165 */       this.serialPort.notifyOnDataAvailable(true);
/*      */     try
/*      */     {
/*  168 */       if (this.serialPort != null)
/*      */       {
/*  170 */         this.serialPort.setSerialPortParams(COMMPORT.baudrate, 
/*  171 */           COMMPORT.databits, 
/*  172 */           COMMPORT.stopbits, 
/*  173 */           COMMPORT.parity);
/*      */ 
/*  175 */         this.serialPort.setDTR(false);
/*  176 */         this.serialPort.setRTS(false);
/*      */ 
/*  178 */         outStream = this.serialPort.getOutputStream();
/*      */       }
/*      */ 
/*      */     }
/*      */     catch (UnsupportedCommOperationException e)
/*      */     {
/*  184 */       log.info(e.getLocalizedMessage());
/*      */     }
/*      */     catch (IOException e) {
/*  187 */       log.info(e.getLocalizedMessage());
/*      */     }
/*  189 */     SQUI.App.writeLog("Serial Comm is Online...");
/*  190 */     new Thread(this).start();
/*  191 */     new SendRequest().start();
/*  192 */     new parseThread().start();
/*  193 */     new sendResponseKeypad().start();
/*      */   }
/*      */ 
/*      */   public void run()
/*      */   {
/*      */     try {
/*  199 */       Thread.sleep(20000L); } catch (InterruptedException e) {
/*  200 */       System.out.println(e);
/*      */     }
/*      */   }
/*      */ 
/*      */   public void serialEvent(SerialPortEvent event)
/*      */   {
/*  206 */     switch (event.getEventType())
/*      */     {
/*      */     case 2:
/*      */     case 3:
/*      */     case 4:
/*      */     case 5:
/*      */     case 6:
/*      */     case 7:
/*      */     case 8:
/*      */     case 9:
/*      */     case 10:
/*  217 */       break;
/*      */     case 1:
/*  219 */       StringBuffer readBuffer = new StringBuffer();
/*      */       try
/*      */       {
/*      */         int c;
/*  223 */         while (((c = this.inputStream.read()) != 10) || (readBuffer.length() < 3))
/*      */         {
/*      */           int c;
/*  225 */           if (c != 13)
/*  226 */             readBuffer.append((char)c);
/*      */         }
/*  228 */         String scannedInput = readBuffer.toString();
/*  229 */         SQUI.App.writeLogRecv("recv: " + scannedInput);
/*  230 */         if (isProceed(scannedInput) == -1)
/*  231 */           return;
/*  232 */         this.queue.add(scannedInput);
/*      */       }
/*      */       catch (IOException e)
/*      */       {
/*  236 */         log.info("err-recv:" + e.getLocalizedMessage());
/*      */       }
/*      */     }
/*      */   }
/*      */ 
/*      */   private int getLastNo(int idx)
/*      */   {
/*  243 */     switch (idx)
/*      */     {
/*      */     case 0:
/*  246 */       return Increment.GetLastNo();
/*      */     case 1:
/*  248 */       return Increment2.GetLastNo();
/*      */     case 2:
/*  250 */       return Increment3.GetLastNo();
/*      */     case 3:
/*  252 */       return Increment4.GetLastNo();
/*      */     case 4:
/*  254 */       return Increment5.GetLastNo();
/*      */     case 5:
/*  256 */       return Increment6.GetLastNo();
/*      */     case 6:
/*  258 */       return Increment7.GetLastNo();
/*      */     case 7:
/*  260 */       return Increment8.GetLastNo();
/*      */     case 8:
/*  262 */       return Increment9.GetLastNo();
/*      */     case 9:
/*  264 */       return Increment10.GetLastNo();
/*      */     case 10:
/*  266 */       return Increment11.GetLastNo();
/*      */     case 11:
/*  268 */       return Increment12.GetLastNo();
/*      */     case 12:
/*  270 */       return Increment13.GetLastNo();
/*      */     case 13:
/*  272 */       return Increment14.GetLastNo();
/*      */     case 14:
/*  274 */       return Increment15.GetLastNo();
/*      */     case 15:
/*  276 */       return Increment16.GetLastNo();
/*      */     }
/*  278 */     return 0;
/*      */   }
/*      */ 
/*      */   private int isProceed(String recv)
/*      */   {
/*  283 */     if (recv.indexOf(this.dt.getKeypad_response_up()) >= 0)
/*      */     {
/*  285 */       return 1;
/*      */     }
/*  287 */     if (recv.indexOf(this.dt.getKeypad_response_no()) >= 0)
/*      */     {
/*  289 */       return 2;
/*      */     }
/*  291 */     if (recv.indexOf(this.dt.getPref_printer()) >= 0)
/*      */     {
/*  293 */       return 3;
/*      */     }
/*  295 */     if (recv.indexOf(this.dt.getPref_keypad()) >= 0)
/*      */     {
/*  297 */       return 4;
/*      */     }
/*      */ 
/*  300 */     log.warn("undefined response: " + recv);
/*  301 */     return -1;
/*      */   }
/*      */ 
/*      */   private void responseVIP(String recv)
/*      */   {
/*      */     try
/*      */     {
/*  308 */       SQUI.App.writeLog("VIP: " + recv);
/*  309 */       if (recv.indexOf(this.dt.getPref_keypad()) < 0)
/*  310 */         return;
/*  311 */       this.charResponse = recv.getBytes()[1];
/*  312 */       int idx = this.dt.getIndexPort(this.charResponse, true);
/*  313 */       int length = this.dt.getFormat().length();
/*  314 */       String vipNo = recv.substring(2, length + 2);
/*  315 */       log.info("responseVIP->recv: " + this.charResponse);
/*  316 */       log.info("responseVIP->no: " + vipNo);
/*      */ 
/*  318 */       int iVipNo = Integer.parseInt(vipNo);
/*  319 */       CounterDisplay cd = new CounterDisplay();
/*  320 */       cd.setCounterNo(iVipNo);
/*  321 */       cd.setDisplayed(false);
/*  322 */       int idxService = this.dt.getServiceDisplayItem(idx);
/*  323 */       this.mapVIP.put(Integer.valueOf(idxService), cd);
/*  324 */       String key = idxService + "-" + iVipNo;
/*      */ 
/*  326 */       this.mapVIPKeep.put(key, Integer.valueOf(iVipNo));
/*  327 */       sendResponse(idx, idxService, iVipNo);
/*  328 */       cd.setDisplayed(true);
/*      */     }
/*      */     catch (Exception ex)
/*      */     {
/*  332 */       log.warn(ex.getLocalizedMessage());
/*      */     }
/*      */   }
/*      */ 
/*      */   private boolean existNo(int idx)
/*      */   {
/*  338 */     boolean found = false;
/*      */ 
/*  340 */     Iterator iterator = this.queueNo.iterator();
/*  341 */     while (iterator.hasNext())
/*      */     {
/*  343 */       Integer element = (Integer)iterator.next();
/*  344 */       if (element.intValue() != idx)
/*      */         continue;
/*  346 */       this.queueNo.remove();
/*  347 */       found = true;
/*  348 */       break;
/*      */     }
/*      */ 
/*  351 */     return found;
/*      */   }
/*      */ 
/*      */   private boolean isVIPExist(String key)
/*      */   {
/*  356 */     return this.mapVIPKeep.containsKey(key);
/*      */   }
/*      */ 
/*      */   private void responseNo(String recv)
/*      */   {
/*  361 */     SQUI.App.writeLog("NO: " + recv);
/*  362 */     this.charResponse = recv.getBytes()[1];
/*  363 */     log.info("resp_no->char response [1]: " + this.charResponse);
/*  364 */     int idx = 0;
/*  365 */     if (recv.indexOf(this.dt.getPref_keypad()) < 0)
/*  366 */       return;
/*  367 */     idx = this.dt.getIndexPort(this.charResponse, true);
/*  368 */     log.info("resp_no->idx: " + idx);
/*  369 */     if (idx == 0) return;
/*  370 */     if (!existNo(idx)) return;
/*  371 */     int idxService = this.dt.getServiceDisplayItem(idx);
/*  372 */     if (idxService == 0) return;
/*  373 */     log.info("resp_no->idxService: " + idxService);
/*  374 */     if (this.mapVIP.containsKey(Integer.valueOf(idxService)))
/*      */     {
/*  376 */       CounterDisplay cd = (CounterDisplay)this.mapVIP.get(Integer.valueOf(idxService));
/*  377 */       if ((cd != null) && (!cd.isDisplayed()))
/*      */       {
/*  379 */         int vipNo = cd.getCounterNo();
/*      */ 
/*  381 */         sendResponse(idx, idxService, vipNo);
/*  382 */         cd.setDisplayed(true);
/*  383 */         return;
/*      */       }
/*      */ 
/*  386 */       String key = idxService + "-" + this.counter_up[(idxService - 1)];
/*  387 */       while (isVIPExist(key))
/*      */       {
/*  389 */         if (!this.mapVIPKeep.containsKey(key)) {
/*      */           continue;
/*      */         }
/*  392 */         this.counter_up[(idxService - 1)] += 1;
/*  393 */         this.counter_down[(idxService - 1)] += 1;
/*  394 */         key = idxService + "-" + this.counter_up[(idxService - 1)];
/*  395 */         if (idxService == 1)
/*  396 */           Increment.Inc();
/*  397 */         else if (idxService == 2)
/*  398 */           Increment2.Inc();
/*  399 */         else if (idxService == 3)
/*  400 */           Increment3.Inc();
/*  401 */         else if (idxService == 4)
/*  402 */           Increment4.Inc();
/*  403 */         else if (idxService == 5)
/*  404 */           Increment5.Inc();
/*  405 */         else if (idxService == 6)
/*  406 */           Increment6.Inc();
/*  407 */         else if (idxService == 7)
/*  408 */           Increment7.Inc();
/*  409 */         else if (idxService == 8)
/*  410 */           Increment8.Inc();
/*  411 */         else if (idxService == 9)
/*  412 */           Increment9.Inc();
/*  413 */         else if (idxService == 10)
/*  414 */           Increment10.Inc();
/*  415 */         else if (idxService == 11)
/*  416 */           Increment11.Inc();
/*  417 */         else if (idxService == 12)
/*  418 */           Increment12.Inc();
/*  419 */         else if (idxService == 13)
/*  420 */           Increment13.Inc();
/*  421 */         else if (idxService == 14)
/*  422 */           Increment14.Inc();
/*  423 */         else if (idxService == 15)
/*  424 */           Increment15.Inc();
/*  425 */         else if (idxService == 16) {
/*  426 */           Increment16.Inc();
/*      */         }
/*      */       }
/*      */     }
/*      */ 
/*  431 */     boolean state = true;
/*  432 */     if (!state)
/*  433 */       return;
/*  434 */     log.info("counter_down:" + this.counter_down[(idxService - 1)] + ",counter_up: " + this.counter_up[(idxService - 1)]);
/*  435 */     if (this.counter_down[(idxService - 1)] == this.counter_up[(idxService - 1)]) {
/*  436 */       return;
/*      */     }
/*      */ 
/*  439 */     this.counter_down[(idxService - 1)] += 1;
/*      */ 
/*  441 */     log.info("send_response:" + this.counter_down[(idxService - 1)]);
/*  442 */     sendResponse(idx, idxService, this.counter_down[(idxService - 1)]);
/*      */   }
/*      */ 
/*      */   private void responsePrinter(String recv)
/*      */   {
/*  447 */     SQUI.App.writeLog("PRINTER: " + recv);
/*  448 */     String antrians = recv.split("\\r")[0];
/*  449 */     log.info("resp_printer: " + antrians);
/*  450 */     antrians = antrians.substring(2, antrians.length());
/*  451 */     String pAntrian = antrians;
/*  452 */     int idxStart = 0;
/*  453 */     int idx = 0;
/*      */     try
/*      */     {
/*      */       do
/*      */       {
/*  458 */         int length = this.dt.getFormat().length();
/*  459 */         String antrian = antrians.substring(idxStart, idxStart + length);
/*  460 */         if (idx == 0)
/*  461 */           Services.MAX_COUNTER_1 = Integer.parseInt(antrian);
/*  462 */         else if (idx == 1)
/*  463 */           Services.MAX_COUNTER_2 = Integer.parseInt(antrian);
/*  464 */         else if (idx == 2)
/*  465 */           Services.MAX_COUNTER_3 = Integer.parseInt(antrian);
/*  466 */         else if (idx == 3)
/*  467 */           Services.MAX_COUNTER_4 = Integer.parseInt(antrian);
/*  468 */         else if (idx == 4)
/*  469 */           Services.MAX_COUNTER_5 = Integer.parseInt(antrian);
/*  470 */         else if (idx == 5)
/*  471 */           Services.MAX_COUNTER_6 = Integer.parseInt(antrian);
/*  472 */         else if (idx == 6)
/*  473 */           Services.MAX_COUNTER_7 = Integer.parseInt(antrian);
/*  474 */         else if (idx == 7)
/*  475 */           Services.MAX_COUNTER_8 = Integer.parseInt(antrian);
/*  476 */         else if (idx == 8)
/*  477 */           Services.MAX_COUNTER_9 = Integer.parseInt(antrian);
/*  478 */         else if (idx == 9)
/*  479 */           Services.MAX_COUNTER_10 = Integer.parseInt(antrian);
/*  480 */         else if (idx == 10)
/*  481 */           Services.MAX_COUNTER_11 = Integer.parseInt(antrian);
/*  482 */         else if (idx == 11)
/*  483 */           Services.MAX_COUNTER_12 = Integer.parseInt(antrian);
/*  484 */         else if (idx == 12)
/*  485 */           Services.MAX_COUNTER_13 = Integer.parseInt(antrian);
/*  486 */         else if (idx == 13)
/*  487 */           Services.MAX_COUNTER_14 = Integer.parseInt(antrian);
/*  488 */         else if (idx == 14)
/*  489 */           Services.MAX_COUNTER_15 = Integer.parseInt(antrian);
/*  490 */         else if (idx == 15) {
/*  491 */           Services.MAX_COUNTER_16 = Integer.parseInt(antrian);
/*      */         }
/*  493 */         SQUI.App.displayTickerCounter(idx);
/*  494 */         idx++;
/*  495 */         idxStart += length;
/*  496 */       }while (idxStart < pAntrian.length());
/*      */     }
/*      */     catch (Exception localException)
/*      */     {
/*      */     }
/*      */ 
/*  502 */     log.info("resp_printer->1->" + Services.MAX_COUNTER_1 + ";2->" + Services.MAX_COUNTER_2 + ";3->" + Services.MAX_COUNTER_3 + ";4->" + Services.MAX_COUNTER_4 + 
/*  503 */       ";5->" + Services.MAX_COUNTER_5 + ";6->" + Services.MAX_COUNTER_6 + ";7->" + Services.MAX_COUNTER_7 + ";8->" + Services.MAX_COUNTER_8 + 
/*  504 */       ";9->" + Services.MAX_COUNTER_9 + ";10->" + Services.MAX_COUNTER_10 + ";11->" + Services.MAX_COUNTER_11 + ";12->" + Services.MAX_COUNTER_12 + ";13->" + Services.MAX_COUNTER_13 + 
/*  505 */       ";14->" + Services.MAX_COUNTER_14 + ";15->" + Services.MAX_COUNTER_15 + ";16->" + Services.MAX_COUNTER_16);
/*      */   }
/*      */ 
/*      */   private void responseUp(String recv)
/*      */   {
/*  510 */     SQUI.App.writeLog("UP: " + recv);
/*  511 */     this.charResponse = recv.getBytes()[1];
/*  512 */     int idx = 0;
/*  513 */     int idxService = 0;
/*  514 */     if (recv.indexOf(this.dt.getPref_keypad()) >= 0)
/*      */     {
/*  516 */       idx = this.dt.getIndexPort(this.charResponse, true);
/*  517 */       if (idx == 0) return;
/*  518 */       this.queueNo.add(Integer.valueOf(idx));
/*  519 */       idxService = this.dt.getServiceDisplayItem(idx);
/*  520 */       if (idxService == 0) return;
/*  521 */       log.info("counter_up->" + this.counter_up[(idxService - 1)]);
/*  522 */       switch (idxService)
/*      */       {
/*      */       case 1:
/*  525 */         log.info("[" + idxService + "]->MAX_COUNTER_1->" + Services.MAX_COUNTER_1 + ";Last No:" + Increment.GetLastNo());
/*  526 */         if (Services.MAX_COUNTER_1 > Increment.GetLastNo())
/*      */         {
/*  528 */           Increment.Inc();
/*      */         }
/*  530 */         if (Services.MAX_COUNTER_1 <= this.counter_up[(idxService - 1)]) return;
/*  531 */         this.counter_up[(idxService - 1)] += 1;
/*  532 */         break;
/*      */       case 2:
/*  534 */         log.info("[" + idxService + "]->MAX_COUNTER_2->" + Services.MAX_COUNTER_2 + ";Last No:" + Increment2.GetLastNo());
/*  535 */         if (Services.MAX_COUNTER_2 > Increment2.GetLastNo()) {
/*  536 */           Increment2.Inc();
/*      */         }
/*  538 */         if (Services.MAX_COUNTER_2 <= this.counter_up[(idxService - 1)]) return;
/*  539 */         this.counter_up[(idxService - 1)] += 1;
/*  540 */         break;
/*      */       case 3:
/*  542 */         log.info("[" + idxService + "]->MAX_COUNTER_3->" + Services.MAX_COUNTER_3 + ";Last No:" + Increment3.GetLastNo());
/*  543 */         if (Services.MAX_COUNTER_3 > Increment3.GetLastNo())
/*  544 */           Increment3.Inc();
/*  545 */         if (Services.MAX_COUNTER_3 <= this.counter_up[(idxService - 1)]) return;
/*  546 */         this.counter_up[(idxService - 1)] += 1;
/*  547 */         break;
/*      */       case 4:
/*  549 */         log.info("[" + idxService + "]->MAX_COUNTER_4->" + Services.MAX_COUNTER_4 + ";Last No:" + Increment4.GetLastNo());
/*  550 */         if (Services.MAX_COUNTER_4 > Increment4.GetLastNo())
/*  551 */           Increment4.Inc();
/*  552 */         if (Services.MAX_COUNTER_4 <= this.counter_up[(idxService - 1)]) return;
/*  553 */         this.counter_up[(idxService - 1)] += 1;
/*  554 */         break;
/*      */       case 5:
/*  556 */         log.info("[" + idxService + "]->MAX_COUNTER_5->" + Services.MAX_COUNTER_5 + ";Last No:" + Increment5.GetLastNo());
/*  557 */         if (Services.MAX_COUNTER_5 > Increment5.GetLastNo())
/*  558 */           Increment5.Inc();
/*  559 */         if (Services.MAX_COUNTER_5 <= this.counter_up[(idxService - 1)]) return;
/*  560 */         this.counter_up[(idxService - 1)] += 1;
/*  561 */         break;
/*      */       case 6:
/*  563 */         log.info("[" + idxService + "]->MAX_COUNTER_6->" + Services.MAX_COUNTER_6 + ";Last No:" + Increment6.GetLastNo());
/*  564 */         if (Services.MAX_COUNTER_6 > Increment6.GetLastNo())
/*  565 */           Increment6.Inc();
/*  566 */         if (Services.MAX_COUNTER_6 <= this.counter_up[(idxService - 1)]) return;
/*  567 */         this.counter_up[(idxService - 1)] += 1;
/*  568 */         break;
/*      */       case 7:
/*  570 */         log.info("[" + idxService + "]->MAX_COUNTER_7->" + Services.MAX_COUNTER_7 + ";Last No:" + Increment7.GetLastNo());
/*  571 */         if (Services.MAX_COUNTER_7 > Increment7.GetLastNo())
/*  572 */           Increment7.Inc();
/*  573 */         if (Services.MAX_COUNTER_7 <= this.counter_up[(idxService - 1)]) return;
/*  574 */         this.counter_up[(idxService - 1)] += 1;
/*  575 */         break;
/*      */       case 8:
/*  577 */         log.info("[" + idxService + "]->MAX_COUNTER_8->" + Services.MAX_COUNTER_8 + ";Last No:" + Increment8.GetLastNo());
/*  578 */         if (Services.MAX_COUNTER_8 > Increment8.GetLastNo())
/*  579 */           Increment8.Inc();
/*  580 */         if (Services.MAX_COUNTER_8 <= this.counter_up[(idxService - 1)]) return;
/*  581 */         this.counter_up[(idxService - 1)] += 1;
/*  582 */         break;
/*      */       case 9:
/*  584 */         log.info("[" + idxService + "]->MAX_COUNTER_9->" + Services.MAX_COUNTER_9 + ";Last No:" + Increment9.GetLastNo());
/*  585 */         if (Services.MAX_COUNTER_9 > Increment9.GetLastNo())
/*  586 */           Increment9.Inc();
/*  587 */         if (Services.MAX_COUNTER_9 <= this.counter_up[(idxService - 1)]) return;
/*  588 */         this.counter_up[(idxService - 1)] += 1;
/*  589 */         break;
/*      */       case 10:
/*  591 */         log.info("[" + idxService + "]->MAX_COUNTER_10->" + Services.MAX_COUNTER_10 + ";Last No:" + Increment10.GetLastNo());
/*  592 */         if (Services.MAX_COUNTER_10 > Increment10.GetLastNo())
/*  593 */           Increment10.Inc();
/*  594 */         if (Services.MAX_COUNTER_10 <= this.counter_up[(idxService - 1)]) return;
/*  595 */         this.counter_up[(idxService - 1)] += 1;
/*  596 */         break;
/*      */       case 11:
/*  598 */         log.info("[" + idxService + "]->MAX_COUNTER_11->" + Services.MAX_COUNTER_11 + ";Last No:" + Increment11.GetLastNo());
/*  599 */         if (Services.MAX_COUNTER_11 > Increment11.GetLastNo())
/*  600 */           Increment11.Inc();
/*  601 */         if (Services.MAX_COUNTER_11 <= this.counter_up[(idxService - 1)]) return;
/*  602 */         this.counter_up[(idxService - 1)] += 1;
/*  603 */         break;
/*      */       case 12:
/*  605 */         log.info("[" + idxService + "]->MAX_COUNTER_12->" + Services.MAX_COUNTER_12 + ";Last No:" + Increment12.GetLastNo());
/*  606 */         if (Services.MAX_COUNTER_12 > Increment12.GetLastNo())
/*  607 */           Increment12.Inc();
/*  608 */         if (Services.MAX_COUNTER_12 <= this.counter_up[(idxService - 1)]) return;
/*  609 */         this.counter_up[(idxService - 1)] += 1;
/*  610 */         break;
/*      */       case 13:
/*  612 */         log.info("[" + idxService + "]->MAX_COUNTER_13->" + Services.MAX_COUNTER_13 + ";Last No:" + Increment13.GetLastNo());
/*  613 */         if (Services.MAX_COUNTER_13 > Increment13.GetLastNo())
/*  614 */           Increment13.Inc();
/*  615 */         if (Services.MAX_COUNTER_13 <= this.counter_up[(idxService - 1)]) return;
/*  616 */         this.counter_up[(idxService - 1)] += 1;
/*  617 */         break;
/*      */       case 14:
/*  619 */         log.info("[" + idxService + "]->MAX_COUNTER_14->" + Services.MAX_COUNTER_14 + ";Last No:" + Increment14.GetLastNo());
/*  620 */         if (Services.MAX_COUNTER_14 > Increment14.GetLastNo())
/*  621 */           Increment14.Inc();
/*  622 */         if (Services.MAX_COUNTER_14 <= this.counter_up[(idxService - 1)]) return;
/*  623 */         this.counter_up[(idxService - 1)] += 1;
/*  624 */         break;
/*      */       case 15:
/*  626 */         log.info("[" + idxService + "]->MAX_COUNTER_15->" + Services.MAX_COUNTER_15 + ";Last No:" + Increment15.GetLastNo());
/*  627 */         if (Services.MAX_COUNTER_15 > Increment15.GetLastNo())
/*  628 */           Increment15.Inc();
/*  629 */         if (Services.MAX_COUNTER_15 <= this.counter_up[(idxService - 1)]) return;
/*  630 */         this.counter_up[(idxService - 1)] += 1;
/*  631 */         break;
/*      */       case 16:
/*  633 */         log.info("[" + idxService + "]->MAX_COUNTER_16->" + Services.MAX_COUNTER_16 + ";Last No:" + Increment16.GetLastNo());
/*  634 */         if (Services.MAX_COUNTER_16 > Increment16.GetLastNo())
/*  635 */           Increment16.Inc();
/*  636 */         if (Services.MAX_COUNTER_16 <= this.counter_up[(idxService - 1)]) return;
/*  637 */         this.counter_up[(idxService - 1)] += 1;
/*      */       default:
/*  639 */         return;
/*      */       }
/*  641 */       if (recv.indexOf(this.dt.getPref_printer()) < 0)
/*  642 */         return;
/*  643 */       idx = this.dt.getIndexPort(this.charResponse, true);
/*  644 */       idxService = this.dt.getServiceDisplayItem(idx);
/*      */ 
/*  646 */       log.info("pref_printer->idx: " + idx + ";idxService:" + idxService);
/*  647 */       if (idxService == 1)
/*      */       {
/*  649 */         Services.MAX_COUNTER_1 += 1;
/*  650 */         int ticket = Services.MAX_COUNTER_1; return;
/*      */       }
/*  652 */       if (idxService == 2)
/*      */       {
/*  654 */         Services.MAX_COUNTER_2 += 1; return;
/*      */       }
/*  656 */       if (idxService == 3)
/*      */       {
/*  658 */         Services.MAX_COUNTER_3 += 1; return;
/*      */       }
/*  660 */       if (idxService == 4)
/*      */       {
/*  662 */         Services.MAX_COUNTER_4 += 1; return;
/*      */       }
/*  664 */       if (idxService == 5)
/*      */       {
/*  666 */         Services.MAX_COUNTER_5 += 1; return;
/*      */       }
/*  668 */       if (idxService == 6)
/*      */       {
/*  670 */         Services.MAX_COUNTER_6 += 1; return;
/*      */       }
/*  672 */       if (idxService == 7)
/*      */       {
/*  674 */         Services.MAX_COUNTER_7 += 1; return;
/*      */       }
/*  676 */       if (idxService == 8)
/*      */       {
/*  678 */         Services.MAX_COUNTER_8 += 1; return;
/*      */       }
/*  680 */       if (idxService == 9)
/*      */       {
/*  682 */         Services.MAX_COUNTER_9 += 1; return;
/*      */       }
/*  684 */       if (idxService == 10)
/*      */       {
/*  686 */         Services.MAX_COUNTER_10 += 1; return;
/*      */       }
/*  688 */       if (idxService == 11)
/*      */       {
/*  690 */         Services.MAX_COUNTER_11 += 1; return;
/*      */       }
/*  692 */       if (idxService == 12)
/*      */       {
/*  694 */         Services.MAX_COUNTER_12 += 1; return;
/*      */       }
/*  696 */       if (idxService == 13)
/*      */       {
/*  698 */         Services.MAX_COUNTER_13 += 1; return;
/*      */       }
/*  700 */       if (idxService == 14)
/*      */       {
/*  702 */         Services.MAX_COUNTER_14 += 1; return;
/*      */       }
/*  704 */       if (idxService == 15)
/*      */       {
/*  706 */         Services.MAX_COUNTER_15 += 1; return;
/*      */       }
/*  708 */       if (idxService != 16)
/*  709 */         return;
/*  710 */       Services.MAX_COUNTER_16 += 1;
/*      */     }
/*      */   }
/*      */ 
/*      */   private void parse(String recv)
/*      */   {
/*  716 */     log.info("parse->recv:" + recv);
/*  717 */     if (recv.indexOf(this.dt.getKeypad_response_up()) >= 0)
/*      */     {
/*  719 */       this.charResponse = recv.getBytes()[1];
/*  720 */       int idx = 0;
/*  721 */       if (recv.indexOf(this.dt.getPref_keypad()) >= 0)
/*      */       {
/*  723 */         idx = this.dt.getIndexPort(this.charResponse, true);
/*  724 */         if (idx == 0) return;
/*  725 */         int idxService = this.dt.getServiceDisplayItem(idx);
/*      */ 
/*  727 */         if (!this.mapCurrentUp.containsKey(Integer.valueOf(idx)))
/*  728 */           this.mapCurrentUp.put(Integer.valueOf(idx), Boolean.valueOf(true));
/*      */         else {
/*  730 */           this.mapCurrentUp.put(Integer.valueOf(idx), Boolean.valueOf(true));
/*      */         }
/*  732 */         log.info("pref_keypad->idx: " + idx + ";idxService:" + idxService);
/*      */ 
/*  734 */         if (this.counter_up[(idxService - 1)] == 0) {
/*  735 */           this.counter_up[(idxService - 1)] = getLastNo(idxService - 1);
/*      */         }
/*  737 */         log.info("counter_up->" + this.counter_up[(idxService - 1)]);
/*  738 */         if (idxService == 1)
/*      */         {
/*  740 */           log.info("[" + idxService + "]->MAX_COUNTER_1->" + Services.MAX_COUNTER_1 + ";Last No:" + Increment.GetLastNo());
/*  741 */           finishService(this.tiketFormat.format(Increment.GetLastNo()));
/*  742 */           if (Services.MAX_COUNTER_1 > Increment2.GetLastNo())
/*      */           {
/*  744 */             Increment.Inc();
/*      */           }
/*      */ 
/*  747 */           if (Services.MAX_COUNTER_1 > this.counter_up[(idxService - 1)]) {
/*  748 */             this.counter_up[(idxService - 1)] += 1;
/*      */           }
/*      */         }
/*  751 */         else if (idxService == 2)
/*      */         {
/*  753 */           log.info("[" + idxService + "]->MAX_COUNTER_2->" + Services.MAX_COUNTER_2 + ";Last No:" + Increment2.GetLastNo());
/*  754 */           if (Services.MAX_COUNTER_2 > Increment2.GetLastNo())
/*  755 */             Increment2.Inc();
/*  756 */           if (Services.MAX_COUNTER_2 > this.counter_up[(idxService - 1)])
/*  757 */             this.counter_up[(idxService - 1)] += 1;
/*      */         }
/*  759 */         else if (idxService == 3)
/*      */         {
/*  761 */           log.info("[" + idxService + "]->MAX_COUNTER_3->" + Services.MAX_COUNTER_3 + ";Last No:" + Increment3.GetLastNo());
/*  762 */           if (Services.MAX_COUNTER_3 > Increment3.GetLastNo())
/*  763 */             Increment3.Inc();
/*  764 */           if (Services.MAX_COUNTER_3 > this.counter_up[(idxService - 1)])
/*  765 */             this.counter_up[(idxService - 1)] += 1;
/*      */         }
/*  767 */         else if (idxService == 4)
/*      */         {
/*  769 */           log.info("[" + idxService + "]->MAX_COUNTER_4->" + Services.MAX_COUNTER_4 + ";Last No:" + Increment4.GetLastNo());
/*  770 */           if (Services.MAX_COUNTER_4 > Increment4.GetLastNo())
/*  771 */             Increment4.Inc();
/*  772 */           if (Services.MAX_COUNTER_4 > this.counter_up[(idxService - 1)])
/*  773 */             this.counter_up[(idxService - 1)] += 1;
/*      */         }
/*  775 */         else if (idxService == 5)
/*      */         {
/*  777 */           log.info("[" + idxService + "]->MAX_COUNTER_5->" + Services.MAX_COUNTER_5 + ";Last No:" + Increment5.GetLastNo());
/*  778 */           if (Services.MAX_COUNTER_5 > Increment5.GetLastNo())
/*  779 */             Increment5.Inc();
/*  780 */           if (Services.MAX_COUNTER_5 > this.counter_up[(idxService - 1)])
/*  781 */             this.counter_up[(idxService - 1)] += 1;
/*      */         }
/*  783 */         else if (idxService == 6)
/*      */         {
/*  785 */           log.info("[" + idxService + "]->MAX_COUNTER_6->" + Services.MAX_COUNTER_6 + ";Last No:" + Increment6.GetLastNo());
/*  786 */           if (Services.MAX_COUNTER_6 > Increment6.GetLastNo())
/*  787 */             Increment6.Inc();
/*  788 */           if (Services.MAX_COUNTER_6 > this.counter_up[(idxService - 1)])
/*  789 */             this.counter_up[(idxService - 1)] += 1;
/*      */         }
/*  791 */         else if (idxService == 7)
/*      */         {
/*  793 */           log.info("[" + idxService + "]->MAX_COUNTER_7->" + Services.MAX_COUNTER_7 + ";Last No:" + Increment7.GetLastNo());
/*  794 */           if (Services.MAX_COUNTER_7 > Increment7.GetLastNo())
/*  795 */             Increment7.Inc();
/*  796 */           if (Services.MAX_COUNTER_7 > this.counter_up[(idxService - 1)])
/*  797 */             this.counter_up[(idxService - 1)] += 1;
/*      */         }
/*  799 */         else if (idxService == 8)
/*      */         {
/*  801 */           log.info("[" + idxService + "]->MAX_COUNTER_8->" + Services.MAX_COUNTER_8 + ";Last No:" + Increment8.GetLastNo());
/*  802 */           if (Services.MAX_COUNTER_8 > Increment8.GetLastNo())
/*  803 */             Increment8.Inc();
/*  804 */           if (Services.MAX_COUNTER_8 > this.counter_up[(idxService - 1)])
/*  805 */             this.counter_up[(idxService - 1)] += 1;
/*      */         }
/*  807 */         else if (idxService == 9)
/*      */         {
/*  809 */           log.info("[" + idxService + "]->MAX_COUNTER_9->" + Services.MAX_COUNTER_9 + ";Last No:" + Increment9.GetLastNo());
/*  810 */           if (Services.MAX_COUNTER_9 > Increment9.GetLastNo())
/*  811 */             Increment9.Inc();
/*  812 */           if (Services.MAX_COUNTER_9 > this.counter_up[(idxService - 1)])
/*  813 */             this.counter_up[(idxService - 1)] += 1;
/*      */         }
/*  815 */         else if (idxService == 10)
/*      */         {
/*  817 */           log.info("[" + idxService + "]->MAX_COUNTER_10->" + Services.MAX_COUNTER_10 + ";Last No:" + Increment10.GetLastNo());
/*  818 */           if (Services.MAX_COUNTER_10 > Increment10.GetLastNo())
/*  819 */             Increment10.Inc();
/*  820 */           if (Services.MAX_COUNTER_10 > this.counter_up[(idxService - 1)])
/*  821 */             this.counter_up[(idxService - 1)] += 1;
/*      */         }
/*  823 */         else if (idxService == 11)
/*      */         {
/*  825 */           log.info("[" + idxService + "]->MAX_COUNTER_11->" + Services.MAX_COUNTER_11 + ";Last No:" + Increment11.GetLastNo());
/*  826 */           if (Services.MAX_COUNTER_11 > Increment11.GetLastNo())
/*  827 */             Increment11.Inc();
/*  828 */           if (Services.MAX_COUNTER_11 > this.counter_up[(idxService - 1)])
/*  829 */             this.counter_up[(idxService - 1)] += 1;
/*      */         }
/*  831 */         else if (idxService == 12)
/*      */         {
/*  833 */           log.info("[" + idxService + "]->MAX_COUNTER_12->" + Services.MAX_COUNTER_12 + ";Last No:" + Increment12.GetLastNo());
/*  834 */           if (Services.MAX_COUNTER_12 > Increment12.GetLastNo())
/*  835 */             Increment12.Inc();
/*  836 */           if (Services.MAX_COUNTER_12 > this.counter_up[(idxService - 1)])
/*  837 */             this.counter_up[(idxService - 1)] += 1;
/*      */         }
/*  839 */         else if (idxService == 13)
/*      */         {
/*  841 */           log.info("[" + idxService + "]->MAX_COUNTER_13->" + Services.MAX_COUNTER_13 + ";Last No:" + Increment13.GetLastNo());
/*  842 */           if (Services.MAX_COUNTER_13 > Increment13.GetLastNo())
/*  843 */             Increment13.Inc();
/*  844 */           if (Services.MAX_COUNTER_13 > this.counter_up[(idxService - 1)])
/*  845 */             this.counter_up[(idxService - 1)] += 1;
/*      */         }
/*  847 */         else if (idxService == 14)
/*      */         {
/*  849 */           log.info("[" + idxService + "]->MAX_COUNTER_14->" + Services.MAX_COUNTER_14 + ";Last No:" + Increment14.GetLastNo());
/*  850 */           if (Services.MAX_COUNTER_14 > Increment14.GetLastNo())
/*  851 */             Increment14.Inc();
/*  852 */           if (Services.MAX_COUNTER_14 > this.counter_up[(idxService - 1)])
/*  853 */             this.counter_up[(idxService - 1)] += 1;
/*      */         }
/*  855 */         else if (idxService == 15)
/*      */         {
/*  857 */           log.info("[" + idxService + "]->MAX_COUNTER_15->" + Services.MAX_COUNTER_15 + ";Last No:" + Increment15.GetLastNo());
/*  858 */           if (Services.MAX_COUNTER_15 > Increment15.GetLastNo())
/*  859 */             Increment15.Inc();
/*  860 */           if (Services.MAX_COUNTER_15 > this.counter_up[(idxService - 1)])
/*  861 */             this.counter_up[(idxService - 1)] += 1;
/*      */         } else {
/*  863 */           if (idxService != 16)
/*  864 */             return;
/*  865 */           log.info("[" + idxService + "]->MAX_COUNTER_16->" + Services.MAX_COUNTER_16 + ";Last No:" + Increment16.GetLastNo());
/*  866 */           if (Services.MAX_COUNTER_16 > Increment16.GetLastNo())
/*  867 */             Increment16.Inc();
/*  868 */           if (Services.MAX_COUNTER_16 > this.counter_up[(idxService - 1)])
/*  869 */             this.counter_up[(idxService - 1)] += 1;
/*      */         }
/*      */       } else {
/*  872 */         if (recv.indexOf(this.dt.getPref_printer()) < 0)
/*  873 */           return;
/*  874 */         idx = this.dt.getIndexPort(this.charResponse, true);
/*  875 */         int idxService = this.dt.getServiceDisplayItem(idx);
/*      */ 
/*  877 */         log.info("pref_printer->idx: " + idx + ";idxService:" + idxService);
/*      */ 
/*  879 */         if (idxService == 1)
/*      */         {
/*  881 */           Services.MAX_COUNTER_1 += 1;
/*      */ 
/*  883 */           int ticket = Services.MAX_COUNTER_1;
/*  884 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         }
/*  886 */         else if (idxService == 2)
/*      */         {
/*  888 */           Services.MAX_COUNTER_2 += 1;
/*  889 */           int ticket = Services.MAX_COUNTER_2;
/*  890 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         }
/*  892 */         else if (idxService == 3)
/*      */         {
/*  894 */           Services.MAX_COUNTER_3 += 1;
/*  895 */           int ticket = Services.MAX_COUNTER_3;
/*  896 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         }
/*  898 */         else if (idxService == 4)
/*      */         {
/*  900 */           Services.MAX_COUNTER_4 += 1;
/*  901 */           int ticket = Services.MAX_COUNTER_4;
/*  902 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         }
/*  904 */         else if (idxService == 5)
/*      */         {
/*  906 */           Services.MAX_COUNTER_5 += 1;
/*  907 */           int ticket = Services.MAX_COUNTER_5;
/*  908 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         }
/*  910 */         else if (idxService == 6)
/*      */         {
/*  912 */           Services.MAX_COUNTER_6 += 1;
/*  913 */           int ticket = Services.MAX_COUNTER_6;
/*  914 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         }
/*  916 */         else if (idxService == 7)
/*      */         {
/*  918 */           Services.MAX_COUNTER_7 += 1;
/*  919 */           int ticket = Services.MAX_COUNTER_7;
/*  920 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         }
/*  922 */         else if (idxService == 8)
/*      */         {
/*  924 */           Services.MAX_COUNTER_8 += 1;
/*  925 */           int ticket = Services.MAX_COUNTER_8;
/*  926 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         }
/*  928 */         else if (idxService == 9)
/*      */         {
/*  930 */           Services.MAX_COUNTER_9 += 1;
/*  931 */           int ticket = Services.MAX_COUNTER_9;
/*  932 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         }
/*  934 */         else if (idxService == 10)
/*      */         {
/*  936 */           Services.MAX_COUNTER_10 += 1;
/*  937 */           int ticket = Services.MAX_COUNTER_10;
/*  938 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         }
/*  940 */         else if (idxService == 11)
/*      */         {
/*  942 */           Services.MAX_COUNTER_11 += 1;
/*  943 */           int ticket = Services.MAX_COUNTER_11;
/*  944 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         }
/*  946 */         else if (idxService == 12)
/*      */         {
/*  948 */           Services.MAX_COUNTER_12 += 1;
/*  949 */           int ticket = Services.MAX_COUNTER_12;
/*  950 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         }
/*  952 */         else if (idxService == 13)
/*      */         {
/*  954 */           Services.MAX_COUNTER_13 += 1;
/*  955 */           int ticket = Services.MAX_COUNTER_13;
/*  956 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         }
/*  958 */         else if (idxService == 14)
/*      */         {
/*  960 */           Services.MAX_COUNTER_14 += 1;
/*  961 */           int ticket = Services.MAX_COUNTER_14;
/*  962 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         }
/*  964 */         else if (idxService == 15)
/*      */         {
/*  966 */           Services.MAX_COUNTER_15 += 1;
/*  967 */           int ticket = Services.MAX_COUNTER_15;
/*  968 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         } else {
/*  970 */           if (idxService != 16)
/*  971 */             return;
/*  972 */           Services.MAX_COUNTER_16 += 1;
/*  973 */           int ticket = Services.MAX_COUNTER_16;
/*  974 */           insertMonitoring(this.tiketFormat.format(ticket));
/*      */         }
/*      */       }
/*      */ 
/*      */     }
/*  979 */     else if (recv.indexOf(this.dt.getKeypad_response_no()) >= 0)
/*      */     {
/*  981 */       this.charResponse = recv.getBytes()[1];
/*  982 */       log.info("resp_no->char response [1]: " + this.charResponse);
/*  983 */       int idx = 0;
/*  984 */       if (recv.indexOf(this.dt.getPref_keypad()) < 0)
/*  985 */         return;
/*  986 */       idx = this.dt.getIndexPort(this.charResponse, true);
/*  987 */       log.info("resp_no->idx: " + idx);
/*  988 */       if (idx == 0) return;
/*  989 */       int idxService = this.dt.getServiceDisplayItem(idx);
/*  990 */       log.info("resp_no->idxService: " + idxService);
/*      */ 
/*  992 */       if (this.counter_down[(idxService - 1)] == 0)
/*  993 */         this.counter_down[(idxService - 1)] = this.counter_up[(idxService - 1)];
/*  994 */       if (this.mapVIP.containsKey(Integer.valueOf(idx)))
/*      */       {
/*  996 */         CounterDisplay cd = (CounterDisplay)this.mapVIP.get(Integer.valueOf(idx));
/*  997 */         if ((cd != null) && (!cd.isDisplayed()))
/*      */         {
/*  999 */           int vipNo = cd.getCounterNo();
/*      */ 
/* 1001 */           sendResponse(idx, idxService, vipNo);
/* 1002 */           cd.setDisplayed(true);
/* 1003 */           return;
/*      */         }
/*      */ 
/* 1006 */         int vipNo = this.counter_down[(idxService - 1)];
/* 1007 */         String key = idx + "-" + vipNo;
/* 1008 */         if (this.mapVIPKeep.containsKey(key))
/*      */         {
/* 1010 */           if (idxService == 1)
/* 1011 */             Increment.Inc();
/* 1012 */           else if (idxService == 2)
/* 1013 */             Increment2.Inc();
/* 1014 */           else if (idxService == 3)
/* 1015 */             Increment3.Inc();
/* 1016 */           else if (idxService == 4)
/* 1017 */             Increment4.Inc();
/* 1018 */           else if (idxService == 5)
/* 1019 */             Increment5.Inc();
/* 1020 */           else if (idxService == 6)
/* 1021 */             Increment6.Inc();
/* 1022 */           else if (idxService == 7)
/* 1023 */             Increment7.Inc();
/* 1024 */           else if (idxService == 8)
/* 1025 */             Increment8.Inc();
/* 1026 */           else if (idxService == 9)
/* 1027 */             Increment9.Inc();
/* 1028 */           else if (idxService == 10)
/* 1029 */             Increment10.Inc();
/* 1030 */           else if (idxService == 11)
/* 1031 */             Increment11.Inc();
/* 1032 */           else if (idxService == 12)
/* 1033 */             Increment12.Inc();
/* 1034 */           else if (idxService == 13)
/* 1035 */             Increment13.Inc();
/* 1036 */           else if (idxService == 14)
/* 1037 */             Increment14.Inc();
/* 1038 */           else if (idxService == 15)
/* 1039 */             Increment15.Inc();
/* 1040 */           else if (idxService == 16)
/* 1041 */             Increment16.Inc();
/* 1042 */           return;
/*      */         }
/*      */ 
/*      */       }
/*      */ 
/* 1047 */       boolean state = false;
/* 1048 */       if (this.mapCurrentUp.containsKey(Integer.valueOf(idx))) {
/* 1049 */         state = ((Boolean)this.mapCurrentUp.get(Integer.valueOf(idx))).booleanValue();
/*      */       }
/* 1051 */       if (state)
/*      */       {
/* 1053 */         if (this.counter_down[(idxService - 1)] == 0) {
/* 1054 */           this.counter_down[(idxService - 1)] = this.counter_up[(idxService - 1)];
/*      */         }
/* 1056 */         else if (this.counter_down[(idxService - 1)] > this.counter_up[(idxService - 1)]) {
/* 1057 */           return;
/*      */         }
/* 1059 */         sendResponse(idx, idxService, this.counter_down[(idxService - 1)]);
/* 1060 */         this.counter_down[(idxService - 1)] += 1;
/*      */       }
/*      */ 
/* 1063 */       if (state)
/* 1064 */         this.mapCurrentUp.put(Integer.valueOf(idx), Boolean.valueOf(false));
/*      */     }
/*      */     else {
/* 1067 */       if (recv.indexOf(this.dt.getPref_printer()) >= 0)
/*      */       {
/* 1069 */         String antrians = recv.split("\\r")[0];
/* 1070 */         antrians = antrians.substring(2, antrians.length());
/* 1071 */         String pAntrian = antrians;
/* 1072 */         int idxStart = 0;
/* 1073 */         int idx = 0;
/*      */         try
/*      */         {
/*      */           do
/*      */           {
/* 1078 */             int length = this.dt.getFormat().length();
/* 1079 */             String antrian = antrians.substring(idxStart, idxStart + length);
/* 1080 */             if (idx == 0)
/*      */             {
/* 1082 */               Services.MAX_COUNTER_1 = Integer.parseInt(antrian);
/* 1083 */               int ticket = Services.MAX_COUNTER_1;
/* 1084 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1086 */             else if (idx == 1)
/*      */             {
/* 1088 */               Services.MAX_COUNTER_2 = Integer.parseInt(antrian);
/* 1089 */               int ticket = Services.MAX_COUNTER_2;
/* 1090 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1092 */             else if (idx == 2)
/*      */             {
/* 1094 */               Services.MAX_COUNTER_3 = Integer.parseInt(antrian);
/* 1095 */               int ticket = Services.MAX_COUNTER_3;
/* 1096 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1098 */             else if (idx == 3)
/*      */             {
/* 1100 */               Services.MAX_COUNTER_4 = Integer.parseInt(antrian);
/* 1101 */               int ticket = Services.MAX_COUNTER_4;
/* 1102 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1104 */             else if (idx == 4)
/*      */             {
/* 1106 */               Services.MAX_COUNTER_5 = Integer.parseInt(antrian);
/* 1107 */               int ticket = Services.MAX_COUNTER_5;
/* 1108 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1110 */             else if (idx == 5)
/*      */             {
/* 1112 */               Services.MAX_COUNTER_6 = Integer.parseInt(antrian);
/* 1113 */               int ticket = Services.MAX_COUNTER_6;
/* 1114 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1116 */             else if (idx == 6)
/*      */             {
/* 1118 */               Services.MAX_COUNTER_7 = Integer.parseInt(antrian);
/* 1119 */               int ticket = Services.MAX_COUNTER_7;
/* 1120 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1122 */             else if (idx == 7)
/*      */             {
/* 1124 */               Services.MAX_COUNTER_8 = Integer.parseInt(antrian);
/* 1125 */               int ticket = Services.MAX_COUNTER_8;
/* 1126 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1128 */             else if (idx == 8)
/*      */             {
/* 1130 */               Services.MAX_COUNTER_9 = Integer.parseInt(antrian);
/* 1131 */               int ticket = Services.MAX_COUNTER_9;
/* 1132 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1134 */             else if (idx == 9)
/*      */             {
/* 1136 */               Services.MAX_COUNTER_10 = Integer.parseInt(antrian);
/* 1137 */               int ticket = Services.MAX_COUNTER_10;
/* 1138 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1140 */             else if (idx == 10)
/*      */             {
/* 1142 */               Services.MAX_COUNTER_11 = Integer.parseInt(antrian);
/* 1143 */               int ticket = Services.MAX_COUNTER_11;
/* 1144 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1146 */             else if (idx == 11)
/*      */             {
/* 1148 */               Services.MAX_COUNTER_12 = Integer.parseInt(antrian);
/* 1149 */               int ticket = Services.MAX_COUNTER_12;
/* 1150 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1152 */             else if (idx == 12)
/*      */             {
/* 1154 */               Services.MAX_COUNTER_13 = Integer.parseInt(antrian);
/* 1155 */               int ticket = Services.MAX_COUNTER_13;
/* 1156 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1158 */             else if (idx == 13)
/*      */             {
/* 1160 */               Services.MAX_COUNTER_14 = Integer.parseInt(antrian);
/* 1161 */               int ticket = Services.MAX_COUNTER_14;
/* 1162 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1164 */             else if (idx == 14)
/*      */             {
/* 1166 */               Services.MAX_COUNTER_15 = Integer.parseInt(antrian);
/* 1167 */               int ticket = Services.MAX_COUNTER_15;
/* 1168 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1170 */             else if (idx == 15)
/*      */             {
/* 1172 */               Services.MAX_COUNTER_16 = Integer.parseInt(antrian);
/* 1173 */               int ticket = Services.MAX_COUNTER_16;
/* 1174 */               insertMonitoring(this.tiketFormat.format(ticket));
/*      */             }
/* 1176 */             SQUI.App.displayTickerCounter(idx);
/*      */ 
/* 1178 */             log.info("pref_printer->idx: " + idx + ";1->" + Services.MAX_COUNTER_1 + ";2->" + Services.MAX_COUNTER_2 + ";3->" + Services.MAX_COUNTER_3 + ";4->" + Services.MAX_COUNTER_4);
/*      */ 
/* 1180 */             idx++;
/* 1181 */             idxStart += length;
/* 1182 */           }while (idxStart < pAntrian.length());
/*      */         }
/*      */         catch (Exception localException)
/*      */         {
/*      */         }
/*      */ 
/*      */       }
/*      */ 
/* 1191 */       if (recv.indexOf(this.dt.getPref_keypad()) < 0)
/* 1192 */         return;
/* 1193 */       this.charResponse = recv.getBytes()[1];
/* 1194 */       int idx = this.dt.getIndexPort(this.charResponse, true);
/* 1195 */       String vipNo = recv.substring(2, 5);
/*      */ 
/* 1197 */       int iVipNo = Integer.parseInt(vipNo);
/* 1198 */       CounterDisplay cd = new CounterDisplay();
/* 1199 */       cd.setCounterNo(iVipNo);
/* 1200 */       cd.setDisplayed(false);
/* 1201 */       this.mapVIP.put(Integer.valueOf(idx), cd);
/* 1202 */       String key = idx + "-" + iVipNo;
/* 1203 */       this.mapVIPKeep.put(key, Integer.valueOf(iVipNo));
/*      */     }
/*      */   }
/*      */ 
/*      */   private void sendResponse(int idx, int idxService, int lastNo)
/*      */   {
/* 1209 */     String resp = "";
/* 1210 */     if (lastNo == 0) return;
/*      */ 
/* 1212 */     resp = this.dt.getKeypad_command();
/* 1213 */     String keyData = this.dt.getKeyData(idx - 1);
/* 1214 */     log.info("sendResponse->[idx=" + idx + ",keyData=" + keyData + ",lastNo=" + lastNo + "]");
/* 1215 */     if ((keyData != null) && (!keyData.equals("")))
/*      */     {
/* 1217 */       resp = this.dt.replace(resp, "[COUNTER]", keyData);
/* 1218 */       resp = this.dt.replace(resp, "[" + this.dt.getFormat() + "]", this.dec.format(lastNo));
/* 1219 */       log.info("counter disp->" + resp);
/* 1220 */       send(resp);
/*      */     }
/*      */ 
/* 1223 */     resp = this.dt.getPanel_command();
/* 1224 */     String keyPanel = this.dt.getKeyPanel(idx - 1);
/*      */ 
/* 1226 */     if (keyPanel == null) {
/* 1227 */       keyPanel = keyData;
/*      */     }
/* 1229 */     if ((keyPanel != null) && (!keyPanel.equals("")))
/*      */     {
/* 1231 */       resp = this.dt.replace(resp, "[DISPLAY_COUNTER]", keyPanel);
/* 1232 */       resp = this.dt.replace(resp, "[" + this.dt.getFormat() + "]", this.dec.format(lastNo));
/* 1233 */       log.info("sendResponse->monitordisp->" + resp);
/* 1234 */       send(resp);
/*      */     }
/*      */     try {
/* 1237 */       Thread.sleep(this.dt.getSleep());
/*      */     }
/*      */     catch (InterruptedException e) {
/* 1240 */       e.printStackTrace();
/*      */     }
/* 1242 */     SQUI.App.counter(idx, this.dec.format(lastNo));
/* 1243 */     if (this.dt.isPlayVoice())
/*      */     {
/* 1245 */       new PlayVoiceRule(idx, lastNo, idxService, this, this.dt.getFormat()).run();
/*      */ 
/* 1247 */       if (this.xml == null)
/*      */       {
/* 1249 */         SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
/* 1250 */         this.xml = new XMLEngine("datas/" + sdf.format(new Date()) + ".xml", this.dt.getCounter_keypad());
/* 1251 */         this.xml.setXML(this);
/*      */       }
/*      */ 
/* 1254 */       QueueService qs = new QueueService();
/* 1255 */       if (!this.mapQueueService.containsKey(Integer.valueOf(idx)))
/*      */       {
/* 1257 */         this.mapQueueService.put(Integer.valueOf(idx), qs);
/*      */       }
/*      */       else
/*      */       {
/* 1261 */         qs = (QueueService)this.mapQueueService.get(Integer.valueOf(idx));
/*      */       }
/*      */ 
/* 1264 */       if (!qs.isQueueExist(lastNo))
/*      */       {
/* 1266 */         qs.setQueue(lastNo);
/* 1267 */         int no = qs.getNo();
/* 1268 */         no++;
/* 1269 */         this.xml.update(idx, no);
/* 1270 */         qs.setNo(no);
/*      */       }
/*      */     }
/*      */ 
/* 1274 */     if (this.dt.isSendToLCD())
/*      */     {
/* 1276 */       log.info("sendtoLCD->idx:" + idx + ",idx service:" + idxService + ",service code:" + this.dt.getServiceKode(idxService - 1) + ",lastno:" + lastNo);
/* 1277 */       String msg = "A|" + this.dec1.format(idx) + "|" + this.dt.getServiceKode(idxService - 1) + this.dec.format(lastNo);
/* 1278 */       log.info("sendtoLCD->" + msg);
/* 1279 */       LCDProps.LCD.recv(msg);
/*      */     }
/*      */ 
/* 1282 */     int ticket = lastNo;
/* 1283 */     startService(this.tiketFormat.format(ticket));
/*      */   }
/*      */ 
/*      */   public void insertMonitoring(String ticket)
/*      */   {
/*      */     try
/*      */     {
/* 1290 */       Calendar dt = Calendar.getInstance();
/* 1291 */       TimeManagement time = new TimeManagement();
/* 1292 */       if (this.tm.containsKey(ticket))
/*      */       {
/* 1294 */         time = (TimeManagement)this.tm.get(ticket);
/* 1295 */         time.startTime = dt;
/*      */       }
/*      */       else
/*      */       {
/* 1299 */         time.startTime = dt;
/*      */       }
/* 1301 */       this.tm.put(ticket, time);
/* 1302 */       SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
/* 1303 */       SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");
/* 1304 */       String strSQL = "INSERT INTO tbl_monitor (ticket,s_time,strdate) values('" + 
/* 1305 */         ticket + "','" + sdf.format(dt.getTime()) + "','" + sdf1.format(dt.getTime()) + "')";
/*      */ 
/* 1307 */       System.out.println(strSQL);
/* 1308 */       this.db.execute(strSQL);
/*      */     }
/*      */     catch (Exception ex) {
/* 1311 */       System.out.println(ex.getMessage());
/*      */     }
/*      */   }
/*      */ 
/*      */   private void startService(String ticket)
/*      */   {
/*      */     try
/*      */     {
/* 1319 */       Calendar now = Calendar.getInstance();
/* 1320 */       TimeManagement t = new TimeManagement();
/* 1321 */       if (!this.tm.containsKey(ticket))
/* 1322 */         return;
/* 1323 */       t = (TimeManagement)this.tm.get(ticket);
/* 1324 */       t.serviceTime = now;
/* 1325 */       String wait_interval = t.getInterval(t.startTime, now);
/* 1326 */       SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
/* 1327 */       SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");
/* 1328 */       String strSQL = "UPDATE tbl_monitor set sv_time='" + sdf.format(now.getTime()) + "',w_period='" + wait_interval + "' WHERE ticket='" + ticket + "' and strdate='" + sdf1.format(now.getTime()) + "'";
/* 1329 */       this.db.execute(strSQL);
/*      */     }
/*      */     catch (Exception localException)
/*      */     {
/*      */     }
/*      */   }
/*      */ 
/*      */   private void finishService(String ticket)
/*      */   {
/*      */     try {
/* 1339 */       Calendar now = Calendar.getInstance();
/* 1340 */       TimeManagement t = new TimeManagement();
/* 1341 */       if (!this.tm.containsKey(ticket))
/* 1342 */         return;
/* 1343 */       t = (TimeManagement)this.tm.get(ticket);
/* 1344 */       t.endTime = now;
/* 1345 */       String sv_interval = t.getInterval(t.serviceTime, now);
/* 1346 */       SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
/* 1347 */       SimpleDateFormat sdf1 = new SimpleDateFormat("yyyyMMdd");
/* 1348 */       String strSQL = "UPDATE tbl_monitor set f_time='" + sdf.format(now.getTime()) + "',sv_period='" + sv_interval + "' WHERE ticket='" + ticket + "' and strdate='" + sdf1.format(now.getTime()) + "'";
/* 1349 */       this.db.execute(strSQL);
/*      */     }
/*      */     catch (Exception localException)
/*      */     {
/*      */     }
/*      */   }
/*      */ 
/*      */   public void send(String msg) {
/*      */     try {
/* 1358 */       String msgRtn = msg + "\r\n";
/* 1359 */       if (outStream == null)
/* 1360 */         return;
/* 1361 */       outStream.write(msgRtn.getBytes());
/* 1362 */       outStream.flush();
/* 1363 */       log.info("send: " + msgRtn);
/* 1364 */       SQUI.App.writeLog("send: " + msgRtn);
/*      */     }
/*      */     catch (IOException e)
/*      */     {
/* 1368 */       log.info("!send: " + e.getLocalizedMessage());
/*      */     }
/*      */   }
/*      */ 
/*      */   public String serviceCode(int idx)
/*      */   {
/*      */     try
/*      */     {
/* 1376 */       return this.dt.getServiceKode(idx);
/*      */     }
/*      */     catch (Exception localException) {
/*      */     }
/* 1380 */     return "";
/*      */   }
/*      */ 
/*      */   public void Queue(int loket, int no)
/*      */   {
/* 1385 */     QueueService qs = new QueueService();
/* 1386 */     qs.setNo(no);
/* 1387 */     if (!this.mapQueueService.containsKey(Integer.valueOf(loket)))
/*      */     {
/* 1389 */       this.mapQueueService.put(Integer.valueOf(loket), qs);
/*      */     }
/*      */     else
/*      */     {
/* 1393 */       qs = (QueueService)this.mapQueueService.get(Integer.valueOf(loket));
/*      */     }
/*      */ 
/* 1396 */     qs.setNo(no);
/* 1397 */     this.mapQueueService.put(Integer.valueOf(loket), qs);
/*      */   }
/*      */ 
/*      */   public void initXML()
/*      */   {
/* 1561 */     this.xml.init();
/*      */   }
/*      */ 
/*      */   class SendRequest extends Thread
/*      */   {
/*      */     public SendRequest()
/*      */     {
/*      */     }
/*      */ 
/*      */     public void run()
/*      */     {
/* 1408 */       while (SQEngine.this.isPortOpen)
/*      */       {
/* 1410 */         String cmd = "";
/* 1411 */         if (SQEngine.this.dt.isSendToPrinter())
/*      */         {
/* 1413 */           for (int i = 0; i < SQEngine.this.dt.getCounter_printer(); i++)
/*      */           {
/* 1415 */             cmd = SQEngine.this.dt.getPrinter_request();
/* 1416 */             String strIdx = String.valueOf(SQEngine.this.dt.getPrinterItem(i));
/* 1417 */             cmd = SQEngine.this.dt.replace(cmd, "[PRINTER_COUNTER]", strIdx);
/*      */ 
/* 1419 */             for (int j = 0; j < SQEngine.this.dt.getRepeatValue(); j++)
/*      */             {
/* 1421 */               SQEngine.this.send(cmd);
/*      */               try {
/* 1423 */                 Thread.sleep(SQEngine.this.dt.getRepeatInterval());
/*      */               }
/*      */               catch (InterruptedException localInterruptedException) {
/*      */               }
/*      */             }
/*      */             try {
/* 1429 */               Thread.sleep(SQEngine.this.dt.getSleep());
/*      */             }
/*      */             catch (InterruptedException localInterruptedException1)
/*      */             {
/*      */             }
/*      */           }
/*      */         }
/* 1436 */         if (!SQEngine.this.dt.isSendToKeyPad())
/*      */           continue;
/* 1438 */         for (int i = 0; i < SQEngine.this.dt.getCounter_keypad(); i++)
/*      */         {
/* 1440 */           cmd = SQEngine.this.dt.getKeypad_request();
/*      */ 
/* 1442 */           String keyData = SQEngine.this.dt.getKeyData(i);
/* 1443 */           if ((keyData == null) || (keyData.equals("")))
/*      */             continue;
/* 1445 */           cmd = SQEngine.this.dt.replace(cmd, "[COUNTER]", keyData);
/*      */ 
/* 1447 */           SQEngine.this.send(cmd);
/*      */           try {
/* 1449 */             Thread.sleep(SQEngine.this.dt.getSleep());
/*      */           }
/*      */           catch (InterruptedException localInterruptedException2)
/*      */           {
/*      */           }
/*      */         }
/*      */       }
/*      */     }
/*      */   }
/*      */ 
/*      */   class SendResponse extends Thread
/*      */   {
/*      */     private String msg;
/*      */ 
/*      */     public SendResponse(String msg)
/*      */     {
/*      */     }
/*      */ 
/*      */     public void run() {
/* 1469 */       SQEngine.this.send(this.msg);
/*      */     }
/*      */   }
/*      */ 
/*      */   class parseThread extends Thread
/*      */   {
/*      */     public parseThread()
/*      */     {
/* 1477 */       for (int i = 0; i < SQEngine.MAX_SERVICE; i++)
/*      */       {
/* 1479 */         int lastNo = SQEngine.this.getLastNo(i);
/* 1480 */         SQEngine.this.counter_up[i] = lastNo;
/* 1481 */         SQEngine.this.counter_down[i] = lastNo;
/*      */       }
/*      */     }
/*      */ 
/*      */     public void run()
/*      */     {
/* 1487 */       while (SQEngine.this.isPortOpen)
/*      */       {
/* 1489 */         if (SQEngine.this.queue.isEmpty()) {
/*      */           try {
/* 1491 */             Thread.sleep(SQEngine.this.dt.getSleep());
/*      */           }
/*      */           catch (InterruptedException e) {
/* 1494 */             e.printStackTrace();
/*      */           }
/*      */         }
/*      */         else
/*      */         {
/* 1499 */           String recv = (String)SQEngine.this.queue.element();
/* 1500 */           int intType = SQEngine.this.isProceed(recv);
/* 1501 */           switch (intType)
/*      */           {
/*      */           case 1:
/* 1504 */             SQEngine.this.responseUp(recv);
/* 1505 */             SQEngine.this.responseNo(recv);
/* 1506 */             break;
/*      */           case 2:
/* 1508 */             SQEngine.this.responseNo(recv);
/* 1509 */             break;
/*      */           case 3:
/* 1511 */             SQEngine.this.responsePrinter(recv);
/* 1512 */             break;
/*      */           case 4:
/* 1514 */             SQEngine.this.responseVIP(recv);
/*      */           }
/*      */           try
/*      */           {
/* 1518 */             SQEngine.this.queue.remove();
/*      */           }
/*      */           catch (Exception localException)
/*      */           {
/*      */           }
/*      */         }
/*      */       }
/*      */     }
/*      */   }
/*      */ 
/*      */   class sendResponseKeypad extends Thread
/*      */   {
/*      */     public sendResponseKeypad()
/*      */     {
/*      */     }
/*      */ 
/*      */     public void run()
/*      */     {
/* 1536 */       int counter = 0;
/* 1537 */       while (SQEngine.this.isPortOpen)
/*      */       {
/* 1539 */         Collection c = SQEngine.this.sendKeypad.values();
/*      */ 
/* 1541 */         Iterator itr = c.iterator();
/*      */ 
/* 1543 */         while (itr.hasNext())
/*      */         {
/* 1545 */           String data = (String)itr.next();
/* 1546 */           SQEngine.this.send(data);
/*      */           try {
/* 1548 */             Thread.sleep(2500L);
/*      */           }
/*      */           catch (InterruptedException e) {
/* 1551 */             e.printStackTrace();
/*      */           }
/*      */         }
/*      */       }
/*      */     }
/*      */   }
/*      */ }

/* Location:           F:\16 2\SQ.jar
 * Qualified Name:     com.engine.SQEngine
 * JD-Core Version:    0.6.0
 */